﻿
<template>
    <div id="dvContent">
        <div  style="padding: 20px;text-align: right;padding-bottom: 5px;">
            <button type="button" class="btn btn-danger btn-lg" @click="DelPI()"><i class="iconfont icon-jiahao ft12 mr5"></i>批量删除</button>
        </div>
        
        <div class="default-tab ft14 padding20">
            <base-table :pzoption="tableop" @selection-change="handleSelectionChange">
            </base-table>
        </div>


    </div>
</template>

<script>
    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue')
        },
        data: function () {
            return {
                TypeData: [],
                curLeiBie: "",
                searchcontent:"",
                tableop: {
                    title: "流程监控",
                    issel: true,
                    iscz: true,
                    dataset: [],
                    multipleSelection: [],

                    height: 500,
                    isxh: true,
                    dtcxdata: [{ cxname: "所属应用", cxzd: "ProcessName", cxdata: "", cal: "0", datatype: "1", dtsource: [], val: "" }],
                    czltabledata: [
                        {
                            colname: "查看表单", bttype: "text", isshow: true, mangefun: function (rowdata) {
                                top.ComFunJS.winviewform("/ViewV5/AppPage/FORMBI/FormManage.html?vtype=2&piid=" + rowdata.ID, '添加表单', "1000", "");

                            },
                        },
                        {
                            colname: "操作表单", bttype: "text", isshow: true,  mangefun: function (rowdata) {
                                top.ComFunJS.winviewform("/ViewV5/AppPage/FORMBI/Formadmin.html?vtype=2&piid=" + rowdata.ID, '添加表单', "1000", "");

                            },
                        }
                       
                    ],
                    collist: [
                        { colid: "ID", colname: "流程号", isshow: true, istip: true },
                        { colid: "BranchName", colname: "发起部门", isshow: true, istip: true },
                        { colid: "ProcessName", colname: "所属应用", isshow: true, istip: true },
                        { colid: "CRDate", colname: "创建时间", isshow: true, istip: true },
                        { colid: "CRUserName", colname: "发起人", isshow: true, istip: true },
                        { colid: "StatusName", colname: "表单状态", isshow: true, istip: true }

                    ]
                }
            }
        },
        methods: {
            handleSelectionChange(val) {
                this.tableop.multipleSelection = val;
            },
            DelPI: function () {
                var pro = this;
                var ids = [];
                for (var i = 0; i < pro.tableop.multipleSelection.length; i++) {
                    ids.push(pro.tableop.multipleSelection[i].ID);
                }
                if (ids.length == 0) {
                    this.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                ComFunJS.winconfirm("确认要删除吗？", function () {
                    $.getJSON("/api/Bll/ExeAction?Action=FORMBI_CANCELWF", { P1: ids.join(), }, function (result) {
                        if (!result.ErrorMsg) {//流程数据
                            pro.InitWigetData();
                            ComFunJS.winsuccess("操作成功");
                        }
                    })
                }, function () { })
            },
            InitWigetData: function () {
                var pro = this;
                $.getJSON('/api/Bll/ExeAction?Action=FORMBI_GETBDJKDATA', { P1: "", sdate: '2018-01-01' }, function (resultData) {
                    if (resultData.Result.length > 0) {
                        pro.tableop.dataset = resultData.Result;

                    }
                })
            }
            
        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.InitWigetData();
            })

        }
    };
</script>